// src / permission.js文件：用来实现权限拦截
import router from "./router";
import store from "./store";
import nprogress from "nprogress";


//白名单，不需要token也可以跳转
const whiteList = ['/login', '/404']

router.beforeEach((to, from, next) => {
    nprogress.start()
    // if (store.getters.token) {
    //     if (to.path === '/login') {
    //         next('/')
    //         nprogress.done()
    //     } else {
    //         next()
    //     }
    // } else {
    //     if (whiteList.includes(to.path) > -1) {
    //         next()
    //     } else {
    //         next('/login')
    //         nprogress.done()
    //     }
    // }
    next()
})
router.afterEach((to, from, next) => {
    nprogress.done()
})